﻿using System;
using System.ComponentModel;

namespace VXCompany.SilverlightLogging.MVVM.Models.SyncBehaviors
{
	/// <summary>
	/// Specifies available states.
	/// </summary>
	public enum State
	{
		/// <summary>
		/// Indicates stopped state.
		/// </summary>
		Stopped = 0,
		/// <summary>
		/// Indicates started state.
		/// </summary>
		Started = 1,
		/// <summary>
		/// Indicates paused state.
		/// </summary>
		Paused = 2,
		/// <summary>
		/// Indicates a failed state.
		/// </summary>
		Failed = 3
	}

	/// <summary>
	/// Specifies properties and methods for SyncBehavoir.
	/// </summary>
	public interface ISyncBehavior : INotifyPropertyChanged
	{
		/// <summary>
		/// Indicates whether sync is active.
		/// </summary>
		bool IsSynchronizing
		{
			get;
		}
		/// <summary>
		/// Gets name for behavior.
		/// </summary>
		string Name { get; }
		/// <summary>
		/// Gets current state.
		/// </summary>
		State State { get; }

	}

	/// <summary>
	/// Specifies internal properties and methods for SyncBehavoir.
	/// </summary>
	internal interface IInternalSyncBehavior : ISyncBehavior
	{
		/// <summary>
		/// Starts behavior
		/// </summary>
		void Start();
		/// <summary>
		/// Pauses behavior
		/// </summary>
		void Pause();
		/// <summary>
		/// Stops behavior
		/// </summary>
		void Stop();
		/// <summary>
		/// Syncs exceptionmessages to service
		/// </summary>
		void BeginSynchronize();
		/// <summary>
		/// Should be called after sync completes.
		/// </summary>
		/// <param name="success">indicates success or failure</param>
        void EndSynchronize(Result result);
		/// <summary>
		/// Sets the operation that handles sync. (usually a service call)
		/// </summary>
		Action SyncAction
		{
			set;
		}
	}
}
